package com.ruoyi.system.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsTransfer;
import com.ruoyi.system.service.IWmsTransferService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 移库信息Controller
 *
 * @author ruoyi
 * @date 2025-06-28
 */
@RestController
@RequestMapping("/system/wmsTransfer")
public class WmsTransferController extends BaseController
{
    @Autowired
    private IWmsTransferService wmsTransferService;

    /**
     * 查询移库信息列表
     */
    @SaCheckPermission("system:wmsTransfer:list")
    @GetMapping("/list")
    public TableDataInfo<WmsTransfer> list(WmsTransfer wmsTransfer, PageQuery pageQuery)
    {
        return wmsTransferService.selectWmsTransferList(wmsTransfer,pageQuery);
    }

    /**
     * 导出移库信息列表
     */
    /*@SaCheckPermission("system:wmsTransfer:export")
    @Log(title = "移库信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsTransfer wmsTransfer)
    {
        List<WmsTransfer> list = wmsTransferService.selectWmsTransferList(wmsTransfer);
        ExcelUtil<WmsTransfer> util = new ExcelUtil<WmsTransfer>(WmsTransfer.class);
        util.exportExcel(response, list, "移库信息数据");
    }*/

    /**
     * 获取移库信息详细信息
     */
    @SaCheckPermission("system:wmsTransfer:query")
    @GetMapping(value = "/{id}")
    public R<WmsTransfer> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(wmsTransferService.selectWmsTransferById(id));
    }

    /**
     * 新增移库信息
     */
    @SaCheckPermission("system:wmsTransfer:add")
    @Log(title = "移库信息", businessType = BusinessType.INSERT)
    @PostMapping
    public R<Void> add(@RequestBody WmsTransfer wmsTransfer)
    {
        return toAjax(wmsTransferService.insertWmsTransfer(wmsTransfer));
    }

    /**
     * 修改移库信息
     */
    @SaCheckPermission("system:wmsTransfer:edit")
    @Log(title = "移库信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<Void> edit(@RequestBody WmsTransfer wmsTransfer)
    {
        return toAjax(wmsTransferService.updateWmsTransfer(wmsTransfer));
    }

    /**
     * 删除移库信息
     */
    @SaCheckPermission("system:wmsTransfer:remove")
    @Log(title = "移库信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<Void> remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsTransferService.deleteWmsTransferByIds(ids));
    }

    /**
     * 删除移库信息
     */
    @SaCheckPermission("system:wmsTransfer:query")
	@GetMapping("/getTransferOrderNo")
    public R<WmsTransfer> getTransferOrderNo()
    {
        return R.ok(wmsTransferService.getTransferOrderNo());
    }

    /**
     * 作废
     */
    @SaCheckPermission("system:wmsTransfer:edit")
    @Log(title = "移库信息", businessType = BusinessType.UPDATE)
    @PutMapping("/cancellation")
    public R<Void> cancellation(@RequestParam Long id)
    {
        return toAjax(wmsTransferService.cancellation(id));
    }
}
